import { Component } from 'react'

class Onec extends Component {
    constructor() {
        super()
        this.state = {
            
        }
    }
    coc = (e) => {
        // console.log('---');
        
        this.props.stateFn(e)
    }
    submit = () => {
        this.props.submitc()
    }
    editBtn = () => {
        this.props.editBtnc()
    }
    render() {
        return (
            <div>
                <p><input type="text" value={this.props.statec.name} name="name" onChange={this.coc} /></p>
                <p><input type="text" value={this.props.statec.age} name="age" onChange={this.coc} /></p>
                {this.props.statec.flag ? <p><button onClick={() => this.submit()}>提交</button></p> : <p><button onClick={() => this.editBtn()}>修改</button></p>}
            </div>)
    }
}

export default Onec